/**
 * @description 插入表情
 * @author liuwe
 */
import $ from 'wangeditor/dist/utils/dom-core';
import Editor from 'wangeditor';
import PanelMenu from 'wangeditor/dist/menus/menu-constructors/PanelMenu';
import Panel from 'wangeditor/dist/menus/menu-constructors/Panel';
import {MenuActive} from 'wangeditor/dist/menus/menu-constructors/Menu';
import createPanelConf from './create-panel-conf'

class Emoticons extends PanelMenu implements MenuActive {
    constructor(editor: Editor) {
        const $elem = $(
            `<div class="w-e-menu">
                <i class="w-e-icon-happy"></i>
            </div>`
        )
        super($elem, editor)
    }

    /**
     * 创建 panel
     */
    private createPanel(): void {
        const conf = createPanelConf(this.editor)
        const panel = new Panel(this, conf)
        panel.create()
    }

    /**
     * 菜单表情点击事件
     */
    public clickHandler(): void {
        this.createPanel()
    }

    public tryChangeActive() {
    }
}

export default Emoticons
